package com.example.goods_manage.controller;

import com.example.goods_manage.service.CategoryService;
import com.example.goods_manage.utils.AjaxResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <P> @Author: SongKeCheng
 * <P> Type: Class
 * <P> Description: 分类控制器
 * <P> Date: 2024/5/29:19:44
 */

@SuppressWarnings({"unchecked", ""})
@RestController
@RequestMapping("category")
public class CategoryController {
    private static final Logger log = LoggerFactory.getLogger(CategoryController.class);


    @Autowired
    private CategoryService categoryService;

    /**
     * 统计商品的分类
    */
    @GetMapping("/statisticsCategory")
    public AjaxResult statisticsCategory(){
        return categoryService.statisticsCategory();
    }

    /**
     * 获取所有的可用分类信息
     */
    @GetMapping("/findAllCategory")
    public AjaxResult getAllCategory(){
        List allCategory = categoryService.getAllCategory();
        return AjaxResult.success(allCategory);
    }

}
